import http from './request'

/**
 * @description 登录
 * @param {*} data 
 * @returns Promise
 */
export function reqLogin(username, password) {
    const data = {
        username,
        password,
    }

    return http.post('/user/login', data)
}

/**
 * @description 注册
 * @param {*} data 
 * @returns Promise
 */
export function reqRegister(name, password) {
    const formData = new FormData()
    formData.append('name', name)
    formData.append('password', password)

    return http.post('/user/register', formData)
}

export function refreshToken() {
    return http.post('/user/refreshToken')
}